﻿using System;

namespace winS.Unity
{
    /// <summary>
    /// 延时调用句柄
    /// </summary>
    public class DelayCallHandle : Handle
    {
        /// <summary>
        /// 当延时调用完成时调用
        /// </summary>
        public event Action onCompleted;

        internal DelayCallHandle(DelayCallFunction delayCallFunction)
        {
            delayCallFunction.onCompleted += () =>
            {
                onCompleted?.Invoke();
                Finish();
            };
            onFinished += () => Updater.RemoveDelayCall(delayCallFunction);
        }
    }
}